package com.yide.myworld.constants.enums;


import com.yide.myworld.api_result.IEnumCode;

import java.util.Arrays;

public enum NeteaseMsgTypeEnum  implements IEnumCode {
    TEXT("0","文本消息"),
    IMAGE("1","图片消息"),
    VOICE("2","语音消息"),
    CUSTOM("100","自定义消息通知"),
            ;

    private final String code;
    private final String message;

    public String getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.message;
    }

    private NeteaseMsgTypeEnum(final String code, final String message) {
        this.code = code;
        this.message = message;
    }

    /**
     * 根据编码查找枚举
     *
     * @param code 编码
     **/
    public static NeteaseMsgTypeEnum find(String code) {
        return Arrays.stream(values()).filter((input) -> {
            return input.getCode().equals(code);
        }).findFirst().orElse( null);
    }

}
